Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Node / ReticulumProjects / MeshChatX.git / files / scripts / build-macos-universal.sh

Displaying Raw • Download


scripts/build-macos-universal.sh 65ca9ddc823fcc2c8f8653c553b944b85db0875f (65ca9ddc) Text, 3.02 KB

T8b949e#!/usr/bin/env bash
T8b949e# Build darwin-arm64 and darwin-x64 cx_Freeze backends, then electron-builder --mac --universal.
T8b949e# On Apple Silicon, the x64 backend must be built with an x86_64 Python (e.g. Homebrew in /usr/local).
T8b949e# Set PYTHON_CMD_X64 to that interpreter if Poetry's default env is arm64-only.
T8b949e#
T8b949e# Optional env vars:
T8b949e# MESHCHATX_MAC_UNIVERSAL_STRIP_AUDIO=1 Drop _miniaudio.abi3.so from both per-arch
T8b949e# backend trees before lipo. Use this when a
T8b949e# universal2 miniaudio wheel cannot be coerced
T8b949e# into a single-arch build on a given runner.
T8b949e# Audio decode falls back to wave + LXST/pyogg.
T8b949e# MESHCHATX_FRONTEND_PREBUILT=1 Reuse meshchatx/public/ instead of rebuilding.
Tffa657set -euo pipefail

Te6edf3ROOTTff7b72=Ta5d6ff"Tff7b72$(Tffa657cd Ta5d6ff"Tff7b72$(dirname Ta5d6ff"Te6edf3$0Ta5d6ff"Tff7b72)Ta5d6ff/..Ta5d6ff" Tff7b72&& Tffa657pwdTff7b72)Ta5d6ff"
Tffa657cd Ta5d6ff"Te6edf3$ROOTTa5d6ff"

T8b949e# @electron/universal merges x64 and arm64 app bundles and requires every non-binary
T8b949e# file present in both trees to have identical bytes. Per-arch backend-manifest.json
T8b949e# contents always differ, so skip embedding it here. electron/main.js treats a missing
T8b949e# manifest as "skip integrity check" (see verifyBackendIntegrity).
Tffa657export Te6edf3MESHCHATX_SKIP_BACKEND_MANIFESTTff7b72=T79c0ff1

pnpm run electron-postinstall
pnpm run version:sync
T8b949e# Skip frontend rebuild when CI provides a prebuilt meshchatx/public artifact
T8b949e# via the reusable Frontend build workflow. Local invocations leave the flag
T8b949e# unset and continue to build everything from source.
Tff7b72if Tff7b72[Tff7b72[ Ta5d6ff"Tffd700${Te6edf3MESHCHATX_FRONTEND_PREBUILTTff7b72:-Te6edf30Tffd700}Ta5d6ff" !Tff7b72= Ta5d6ff"1" Tff7b72]Tff7b72]Tb4b4b4; Tff7b72then
pnpm run build-frontend
pnpm run build-docs
pnpm run build-repository-wheels
Tff7b72else
Tff7b72if Tff7b72[Tff7b72[ ! -f Ta5d6ff"meshchatx/public/index.html" Tff7b72]Tff7b72]Tb4b4b4; Tff7b72then
Tffa657echo Ta5d6ff"MESHCHATX_FRONTEND_PREBUILT=1 but meshchatx/public/index.html is missing." >Tb4b4b4&T79c0ff2
Tffa657echo Ta5d6ff"Download the frontend artifact into meshchatx/public/ before invoking this script." >Tb4b4b4&T79c0ff2
Tffa657exit T79c0ff1
Tff7b72fi
Tffa657echo Ta5d6ff"Reusing prebuilt frontend assets in meshchatx/public/."
Tff7b72fi
cross-env Te6edf3ARCHTff7b72=arm64 pnpm run build-backend
Te6edf3_arm_miniaudioTff7b72=Ta5d6ff"build/exe/darwin-arm64/lib/_miniaudio.abi3.so"
Tff7b72if Tff7b72[Tff7b72[ -f Ta5d6ff"Te6edf3$_arm_miniaudioTa5d6ff" Tff7b72]Tff7b72]Tb4b4b4; Tff7b72then
Te6edf3_ftTff7b72=Tff7b72$(file --brief --no-pad Ta5d6ff"Te6edf3$_arm_miniaudioTa5d6ff" T79c0ff2>/dev/null Tff7b72|| Tffa657trueTff7b72)
Tff7b72if Tff7b72[Tff7b72[ Ta5d6ff"Te6edf3$_ftTa5d6ff" Tff7b72=Tff7b72= *x86_64* Tff7b72&& Ta5d6ff"Te6edf3$_ftTa5d6ff" !Tff7b72= *arm64* Tff7b72]Tff7b72]Tb4b4b4; Tff7b72then
Tffa657echo Ta5d6ff"darwin-arm64 cx_Freeze output has x86_64-only _miniaudio.abi3.so; universal lipo will fail." >Tb4b4b4&T79c0ff2
Tffa657echo Ta5d6ff"Rebuild miniaudio in the Poetry env (see scripts/ci/github-install-deps.sh) or fix compiler flags." >Tb4b4b4&T79c0ff2
Tffa657exit T79c0ff1
Tff7b72fi
Tff7b72fi
Tff7b72if Tff7b72[Tff7b72[ -n Ta5d6ff"Tffd700${Te6edf3PYTHON_CMD_X64Tff7b72:-Tffd700}Ta5d6ff" Tff7b72]Tff7b72]Tb4b4b4; Tff7b72then
cross-env Te6edf3ARCHTff7b72=x64 Te6edf3PYTHON_CMDTff7b72=Ta5d6ff"Te6edf3$PYTHON_CMD_X64Ta5d6ff" pnpm run build-backend
Tff7b72elif Tff7b72[Tff7b72[ -x Ta5d6ff"Te6edf3$ROOTTa5d6ff/.venv-x64/bin/pythonTa5d6ff" Tff7b72]Tff7b72]Tb4b4b4; Tff7b72then
cross-env Te6edf3ARCHTff7b72=x64 Te6edf3PYTHON_CMDTff7b72=Ta5d6ff"Te6edf3$ROOTTa5d6ff/.venv-x64/bin/pythonTa5d6ff" pnpm run build-backend
Tff7b72else
cross-env Te6edf3ARCHTff7b72=x64 pnpm run build-backend
Tff7b72fi

bash scripts/thin-backend-mach-o.sh

bash scripts/unify-backend-plain-files.sh

Tffa657exec pnpm Tffa657exec electron-builder --mac --universal --publishTff7b72=never


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────